﻿Imports System.Reflection
Imports System.IO

Public Module Resources

    Public Enum SQL
        DemoDatabaseSchema
        DemoStoredProcedures
    End Enum

    Public Function GetSQL(ByVal sql As SQL) As String
        Return GetResource(sql.ToString, ".sql")
    End Function

    Private Function GetResource(ByVal name As String, ByVal fileExtension As String) As String
        Dim ret As String = Nothing
        Dim asm As Assembly = GetType(Resources).Assembly
        Dim ResourceName As String = name & fileExtension
        Using stream As IO.Stream = asm.GetManifestResourceStream(GetType(Resources), ResourceName)
            Using reader As New StreamReader(stream)
                ret = reader.ReadToEnd
            End Using
        End Using
        Return ret
    End Function

End Module
